home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 December
/
1984-12.d64
/
disk backup
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
254 lines
10 sys65517:ifpeek(781)=40thenmt$="":goto30
20 mt$=""
30 gosub1580:ifbr$="r"then450
40 fors1=k1tonf:gosub930
50 get#fp,a$:a$=mid$(a$+c0$,k1,k1):zt=st
60 bk=bk+k1:print up$;tab(17);bk:r$=""
70 geti$:ifi$<>""goto330
80 lb$=a$:lb=asc(lb$):ne=k1
90 ifztthengosub150:gosub220:goto250
100 get#fp,a$:a$=mid$(a$+c0$,k1,k1):zt=st
110 iflen(r$)>cmthengosub150:gosub220:goto60
120 iflb$<>a$then140
130 ifne<250thenne=ne+k1:goto90
140 gosub150:goto80
150 ifne>k1goto190
160 iflb<csthenr$=r$+lb$:return
170 iflb<233 or lb=245thenr$=r$+chr$(230)+lb$:return
180 r$=r$+lb$:return
190 iflb=spthenr$=r$+cs$+chr$(ne):return
200 iflb=dathenr$=r$+chr$(245)+chr$(ne):return
210 r$=r$+chr$(231)+chr$(ne)+lb$:return
220 l$=mid$(str$(len(r$)+k4),k2)
230 print#1,mid$(l$+sp$,k1,k3);"d";r$;
240 nb=nb+len(r$)+4:return
250 gosub410:print up$;tab(30);nb
260 gosub2490:close fp
270 nexts1
280 print"to restore files load this";
290 print" program from the backup tape"
300 gosub 860
310 forsl=k1to20:next
320 goto 2480
330 print"q quit, space continue"
340 geti$:ifi$=""goto340
350 ifi$<>"q"goto370
360 closefp:an$="a":gosub410:goto2480
370 print up$ " " up$
380 print chr$(18) " p to pause" chr$(146) up$:goto80
390 print#1,"024f";mid$(na$+sp$,k1,16);mid$(ty$,k1,k1);mid$(ln$+sp$,k1,k3);
400 nb=nb+24:return
410 print#1,"005e";an$:nb=nb+8:print#1,c0$;c0$;c0$;:close1:return
420 en=len(dt$)
430 ifasc(mid$(dt$,en,1))<>160thenreturn
440 dt$=left$(dt$,en-k1):goto420
450 gosub1110
460 for s1=k1tonf
470 bk=k0:na$=na$(s1):ty$=ty$(s1)
480 open 1,1,0:nb=nb+300:gosub840
490 fm$="":print:print up$ chr$(18) " found" chr$(146) " ";
500 ifrc$<>"f"thenclose1:goto480
510 forx=k1to16:get#1,i$:fm$=fm$+i$:next
520 print fm$:get#1,a$,a$,a$,a$
530 iffm$=na$goto580
540 gosub840:ifrc$="n"thenclose1:gosub1520:goto480
550 nb=nb+ln:forx=k1toln-k4:get#k1,a$:next:gosub840
560 ifrc$="d"goto550
570 close1:goto480
580 x=len(na$):ifmid$(na$,x,k1)=" "thenna$=mid$(na$,k1,x-k1):goto580
590 openfp,8,fp,"@0:"+na$+co$+ty$+",w"
600 gosub840:ifrc$="d"goto640
610 ifrc$="e"goto760
620 ifrc$="n"thengosub1510:goto470
630 print " expected d or e":goto2480
640 bk=bk+k1:print up$;tab(24);bk
650 l=0
660 l=l+k1:ifl>ln-k4goto600
670 get#1,a$:a$=mid$(a$+c0$,k1,k1):a=asc(a$)
680 ifa<230thenprint#fp,a$;:goto660
690 ifa=230thenget#1,a$:l=l+k1:a$=mid$(a$+c0$,k1,k1):print#fp,a$;:goto660
700 ifa=231then730
710 ifa=232 or a=245 then750
720 print#fp,a$;:goto660
730 get#1,a$,a1$:l=l+k2:a1$=mid$(a1$+c0$,k1,k1)
740 forx=k1toasc(a$):print#fp,a1$;:next:goto660
750 get#1,a1$:l=l+k1:forx=k1toasc(a1$):print#fp,chr$(a-200);:next:goto660
760 gosub2490:close1:close fp
770 if a$<>"a"goto820
780 print " file'" na$ "' is incomplete
790 [153]"q to quit, space to continue
800 geta$:ifa$=""goto800
810 ifa$="q"goto2480
820 next s1:gosub860
830 forsl=k1to20:next:goto2480
840 get#1,l1$,l2$,l3$,rc$
850 ln=val(l1$+l2$+l3$):nb=nb+ln:return
860 tt=val(mid$(ti$,k1,k2))*3600+val(mid$(ti$,k3,k2))*60
870 tt=tt+int(nb/25):hh=int(tt/3600)
880 mm=int((tt-hh*3600)/60)
890 hh$=mid$(str$(hh),2):iflen(hh$)<2thenhh$="0"+hh$
900 mm$=mid$(str$(mm),2):iflen(mm$)<2thenmm$="0"+mm$
910 ti$=hh$+mm$+"00":print "estimated time=";ti$
920 return
930 na$=na$(s1):ty$=ty$(s1)
940 ifnb+ln(s1)*(bd+5)+bh<tb goto1050
950 open 1,1,1,na$:gosub390
960 print#1,"004n";:close1
970 print " load another cassette"
980 print " type q to quit,"
990 print " space to continue"
1000 geta$:if a$="" then1000
1010 if a$="q" goto2480
1020 print " tape size (min) ";tm;mid$(bs$,1,len(str$(tm))+2);
1030 input tm$:iftm$=""thentm$=str$(tm)
1040 tb=val(tm$)*bm:gosub860:nb=k0
1050 print sp$;cr$
1060 print" [145]p to pause[146]":printup$ up$
1070 printna$:bk=k0
1080 ln$=mid$(str$(ln(s1)),k2)
1090 open fp,8,fp,"0:"+na$+co$+ty$+",r"
1100 open 1,1,1,na$:nb=nb+bh:gosub390:return
1110 print " format disk (n or y)"
1120 input" ";a$
1130 ifa$<>"y"goto1200
1140 nd$="":print " disk name";
1150 inputnd$:ifnd$=""goto1200
1160 id$="":print " disk id ";
1170 inputid$:ifid$=""goto1200
1180 print#15,"n0:";nd$;",";id$
1190 gosub 2490:ife1then2490
1200 print " open dtb.id.file"
1210 open 1,1,0,"dtb.id.file"
1220 nb=nb+300
1230 gosub840
1240 get#1,a$
1250 ifa$<>vn$ thenprint " version error":goto2480
1260 print "[147] from disk:";
1270 forx=1to20:get#1,a$:print a$;:next
1280 print:print "backed up on date:";
1290 forx=1to8 :get#1,a$:print a$;:next
1300 print " time:";
1310 forx=1to6 :get#1,a$:print a$;:next
1320 print
1330 nf=0
1340 gosub840
1350 ifrc$="f" then1380
1360 ifrc$="e" then close1:return
1370 print " rec cd error":goto2480
1380 na$="":forx=1to16:get#1,a$:printa$;
1390 na$=na$+a$:next
1400 get#1,ty$:print" "ty$" ";
1410 get#1,a$,a2$,a3$:print a$;a2$;a3$;
1420 print:ifaf$="y"then1480
1430 print up$:print"bkup y or n";
1440 yn$="":input yn$
1450 ifmid$(yn$+"y",k1,k1)="y"goto1480
1460 if yn$="n"goto1340
1470 goto1430
1480 nf=nf+k1
1490 na$(nf)=na$:ty$(nf)=ty$:goto1340
1500 return
1510 closefp:close1
1520 print" load continuation tape"
1530 print" type q to quit"
1540 print" space to continue"
1550 geta$:ifa$=""goto1550
1560 ifa$="q"goto2480
1570 gosub860:nb=0:return
1580 dim ln(150),na$(150),t$(4),ty$(150)
1590 bh=300:bd=256:bk=0:bm=840:bo=53280:cm=250:cs=230:da=45:dir=8:fp=5
1600 k0=0:k1=1:k2=2:k3=3:k4=4
1610 nb=0:nc=0:ne=0:nf=0:ps=8000:sp=32:tb=0:tm=60
1620 af$="":an$="n":br$="":forx=1to40:bs$=bs$+chr$(157):next
1630 c0$=chr$(0):cb$="":co$=",":cs$=chr$(232)
1640 da$="":dn$="":fm$="":rc$="":sp$=" ":sp$=sp$+sp$+sp$:up$=chr$(145)
1650 vn$="2"
1660 open15,8,15:poke bo,0
1670 printmt$:printchr$(147):print" disk to tape backup"
1680 t$(k0)="del":t$(1)="seq":t$(2)="prg":t$(3)="usr":t$(4)="rel"
1690 print"backup or restore":input"(b or r)";br$
1700 br$=mid$(br$+" ",1,1)
1710 if br$<>"b" and br$<>"r" goto2480
1720 print"process all files":input"(y or n)";af$
1730 af$=mid$(af$+"y",1,1)
1740 if af$<>"y" and af$<>"n" goto2480
1750 if br$="r"then1890
1760 print "tape size (min) ";tm;mid$(bs$,1,len(str$(tm))+2);
1770 input tm$:iftm$=""thentm$=str$(tm)
1780 tm=val(tm$):tb=tm*bm
1790 open 3,8,3,"0:sys date,s,r"
1800 input#15,e1,e2$,e3,e4
1810 if e1 then d$="00/00/00":goto1830
1820 input#3,d$
1830 close3
1840 print " mm/dd/yy ";
1850 input da$:if da$="" then da$=d$
1860 if d$=da$ goto1890
1870 da$=mid$(da$+" ",1,8):open 3,8,3,"@0:sys date,s,w":
1880 gosub2490:print#3,da$:close3
1890 t$=ti$
1900 print " hhmm ? "t$;mid$(bs$,1,len(t$)+2);
1910 input t$:ti$=mid$(t$+"000000",1,6)
1920 if br$="r"thenreturn
1930 print"[147] reading directory":open dir,8,dir,"$"
1940 for l=k1 to 142:get#dir,a$:next
1950 dn$="":forl=k1to16:get#dir,a$
1960 dn$=dn$+a$:next:print "[147] disk:"dn$;
1970 dt$=dn$:gosub420:dn$=dt$
1980 get#dir,a$,a$,i1$,i2$,a$,o1$,o2$
1990 print" id:";i1$;i2$;:print" os:";o1$;o2$""
2000 for l=k1to89:get#dir,a$:next
2010 nf=0
2020 rb=dir:r$=""
2030 forr=k1to254:get#rb,a$:r$=r$+mid$(a$+c0$,k1,k1):next:zs=st
2040 b=k0
2050 print"[147] disk:"dn$;
2060 printtab(23)"id:";i1$;i2$;:print" os:";o1$;o2$""
2070 for p=k1 to 8
2080 t=asc(mid$(r$,b+k1)):ift=k0thent=128
2090 l=asc(mid$(r$,b+29)):h=asc(mid$(r$,b+30))
2100 l=(l+256*h):ifl=k0then2200
2110 n$=mid$(r$,b+k4,16)
2120 ty$=t$(t-128):if ty$="del"then2200
2130 dt$=n$:gosub420:n$=dt$
2140 print l;tab(4);ty$;" ";n$
2150 ifaf$="y" then print:goto2180
2160 print" y/n ? y";mid$(bs$,1,3);
2170 yn$="":inputyn$:ifyn$="n"goto2200
2180 nf=nf+k1:na$(nf)=n$
2190 ty$(nf)=mid$(ty$,k1,k1):ln(nf)=l
2200 b=b+32:next p:print" please wait..."
2210 if zs=k0 then2020
2220 close dir
2230 if nf<k2then2360
2240 fori=1to2000:next:print "[147] sorting ...."
2250 fors1=k1tonf-k1:sm=s1
2260 fors2=s1+k1tonf
2270 if na$(sm)>na$(s2)thensm=s2
2280 nexts2
2290 ifsm=s1then2330
2300 na$(k0)=na$(s1):na$(s1)=na$(sm):na$(sm)=na$(0)
2310 ty$(k0)=ty$(s1):ty$(s1)=ty$(sm):ty$(sm)=ty$(0)
2320 ln(k0)=ln(s1):ln(s1)=ln(sm):ln(sm)=ln(0)
2330 print " " na$(s1)
2340 nexts1:print" "na$(nf):print
2350 gosub 2520:nb=nb+ps
2360 open 1,1,1,"dtb.id.file"
2370 nb=nb+bh+39
2380 print#1,"039v";vn$;
2390 print#1,mid$(dn$+sp$,k1,20);
2400 print#1,mid$(da$+sp$,k1,8);ti$;
2410 fors1=k1tonf
2420 ln$=mid$(str$(ln(s1)),k2)
2430 na$=na$(s1):ty$=ty$(s1)
2440 gosub390
2450 nexts1:gosub 410
2460